Skip to content

0.3.4: repetition_penalty + auto max_inference_depth (decoding-only) - #61

Merged
FonaTech merged 1 commit into
mainfrom
dev-0.3.4-decoding
Nov 18, 2026
Merged

FonaTech merged 1 commit into
mainfrom
dev-0.3.4-decoding

Conversation

@FonaTech

Copy link
Copy Markdown
Owner

What this is

Two decoding-side fixes on the shared_first serving path, measured on the shipped 50M en-zh SFT checkpoint and five matched 30-min 15M arms (base, A_dtcap, B_plain, C_periter, obj_lm). No kernel code, no retraining. Callers that leave repetition_penalty=1.0 see no behaviour change.

Changes

  • repetition_penalty threaded through chronos.runtime.speculative.speculative_generate, chronos.serving.runtime.generate_stream, chronos.serving.adapter.ChronosServingAdapter.generate, and the Ollama/OpenAI HTTP layer. CTRL rule applied on the raw logits before draft and verify so speculative rejection sampling still draws exactly from the full-depth target (Leviathan et al. 2023). Default 1.0.
  • max_inference_depth auto-select at load time. The runtime picks the largest depth d whose cumulative trained dt[:d] ≤ 1.15, keeping the iterated map inside the Lipschitz region L ≤ 1. On the 50M CPT checkpoint (trained dt_sum = 1.825) this picks d = 3 (cum_dt = 1.108), the measured sweet spot in the depth sweep. Opt out with config.auto_inference_depth=False or CHRONOS_AUTO_INFERENCE_DEPTH=0.
  • Combined effect on the shipped 50M SFT checkpoint, 60-token greedy: unique_ratio 0.129 → 0.692; max_4gram 8.83 → 2.33. No retraining.

What this does not do

  • Does not change factual recall. 60-token greedy with repetition_penalty=1.15 still produces "Paris is the capital of the United States" / "水的沸点是水中水". The remedy is more data / tokens, not a kernel knob.
  • Does not change the default recurrent_attention_mode. per_iteration (C_periter) is the cleanest decoder in the ABC runs (max_4gram 10.7 vs 18.6) but costs 4× KV memory, disables inference-time depth override, and disables speculative decoding.
  • Does not change training presets. Depth=4 is over-budget at 15M scale per the B_plain arm, but the right preset at each scale needs the full tokenizer-v2 training runs to validate.

Experiments

experiments/loop_depth_15m/results_abc/ — five 30-min 15M arms, each with its .pth, metrics.jsonl, probe JSON, and a final findings file.

arm depth attn_mode aux_losses valid_ce unique max_4gram dt_sum
base 4 shared_first on 4.735 0.151 18.6 0.961
A_dtcap 4 shared_first cap 0.5 4.768 0.124 19.7 0.577
B_plain 1 — on 4.528 0.150 15.3 1.00
C_periter 4 per_iteration on 4.727 0.144 10.7 0.967
obj_lm 4 shared_first off 4.533 0.201 16.8 1.858

Tests

  • tests/test_0_3_4_decoding.py — 6 new cases.
  • Existing tests/test_speculative.py (14 cases) and all 57 serving-related tests pass.
  • Full suite minus pre-existing MLX long-context tolerance failures (unrelated, confirmed on 0.3.3 head): 689 passed, 1 skipped.

🤖 Generated with Claude Code

Two decoding-side fixes on the shared_first serving path, measured on the
shipped 50M en-zh SFT checkpoint and five matched 30-min 15M arms. No
kernel code, no retraining. Callers that leave repetition_penalty=1.0
see no behaviour change.

repetition_penalty is threaded through speculative_generate,
generate_stream, the OpenAI/Ollama serving adapter, and the ollama_server
HTTP layer. The CTRL rule is applied on the raw logits before draft and
verify so speculative rejection sampling still draws exactly from the
full-depth target (Leviathan et al. 2023). Default 1.0.

max_inference_depth now auto-selects at load time: the runtime picks the
largest depth d whose cumulative trained dt is <= 1.15, keeping the
iterated map inside the Lipschitz region. On the 50M CPT checkpoint
(trained dt_sum 1.825) the selector picks d=3 (cum 1.108), the measured
sweet spot. Opt out per checkpoint with config.auto_inference_depth or
process-wide with CHRONOS_AUTO_INFERENCE_DEPTH=0.

Combined on the shipped 50M SFT checkpoint, 60-token greedy unique_ratio
goes 0.129 -> 0.692 and max_4gram 8.83 -> 2.33 with no retraining.

Experiments landed under experiments/loop_depth_15m/results_abc with
findings. Kernel is not wrong; current preset recurrent_depth=4 is
over-budgeted for small checkpoints — documented, no default change.

Tests: tests/test_0_3_4_decoding.py (6 cases); existing speculative and
serving suites unchanged (14+57 passing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FonaTech
FonaTech merged commit 26f3bb4 into main Nov 18, 2026
3 checks passed
@FonaTech
FonaTech deleted the dev-0.3.4-decoding branch November 18, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant